﻿using Basic.WxApiRemoteModel;
using Basic.WxApiRemoteModel.WxMini.Model;
using Basic.WxApiService.ApiInterface;
using Basic.WxApiService.Interface;
using Basic.WxApiService.WxModel;
using WeDonekRpc.Client.Attr;

namespace Basic.WxApiService.WxMini
{
    [ClassLifetimeAttr(ClassLifetimeType.SingleInstance)]
    internal class WxMiniQrService : IWxMiniQrService
    {
        private static readonly WxPrower _Prower = WxPrower.帐号管理权限小程序;
        private readonly IWxMerTokenService _TokenService;
        private readonly IMiniApi _MiniApi;
        public WxMiniQrService (IWxMerTokenService token,
            IMiniApi miniApi)
        {
            this._TokenService = token;
            this._MiniApi = miniApi;
        }

        public byte[] CreateQr (string wxAppId, QrCreateParam param)
        {
            WxMerToken token = this._TokenService.GetToken(wxAppId, _Prower);
            return this._MiniApi.CreateQr(token, param);
        }
    }
}
